//
//  VerifyPhoneView.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/7.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "VerifyPhoneView.h"

@interface VerifyPhoneView ()
{
    GLGWLabel *lab;
}
@end

@implementation VerifyPhoneView

- (id)initWithFrame:(CGRect)aFrame inSuperView:(UIView *)aSuperView
{
    if (self = [super initWithFrame:aFrame inSuperView:aSuperView]) {
        self.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        
        GLGWView *liView = [[GLGWView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kHeightProportion_In_iPhoneTriploid(10)) inSuperView:self];
        liView.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        
        GLGWView *midelView = [[GLGWView alloc] initWithInSuperView:self];
        midelView.backgroundColor = [UIColor whiteColor];
        [midelView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(liView.mas_bottom);
            make.left.right.equalTo(self);
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(89)));
        }];
        
        GLGWLabel *lab1 = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:kColor_Rule_Black inSuperView:midelView];
        [lab1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(midelView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(midelView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(12));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
        }];
        lab1.text = @"手机号";
        
        GLGWLabel *lab2 = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:kColor_Rule_Black inSuperView:midelView];
        [lab2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(lab1.mas_left);
            make.top.equalTo(lab1.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(25));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
        }];
        lab2.text = @"验证码";
        
        GLGWLabel *lab3 = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:midelView];
        [lab3 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(midelView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.centerY.equalTo(lab1.mas_centerY);
        }];
        lab3.text = @"15099449612";
        lab = lab3;
        
        GLGWButton *riBtn = [[GLGWButton alloc] initWithTitle:@"发送校验码" titleLableFont:SYSTEMFONT(14) titleLableColor:[UIColor colorWithHexString:@"#333333"] inSuperView:midelView];
        [riBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(midelView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.centerY.equalTo(lab2.mas_centerY);
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(40)));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(90)));
        }];
        self.rightBtn = riBtn;
        [riBtn setBackgroundColor:kRandomColor];
        riBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
        
        NSString *holderText = @"请输入验证码";
        GLGWTextField *textField = [[GLGWTextField alloc] initTitlePlaceholder:holderText theFont:SYSTEMFONT(14) theTitColor:kColor_Rule_Black inSuperView:midelView];
        [textField mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(riBtn.mas_left).offset(-kWidthProportion_In_iPhoneTriploid(6));
            make.left.equalTo(lab2.mas_right).offset(kWidthProportion_In_iPhoneTriploid(20));
            make.centerY.equalTo(lab2.mas_centerY);
            make.height.equalTo(lab2);
        }];
        NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc] initWithString:holderText];
        [placeholder addAttribute:NSForegroundColorAttributeName
                            value:[UIColor colorWithHexString:@"#999999"]
                            range:NSMakeRange(0, holderText.length)];
        [placeholder addAttribute:NSFontAttributeName
                            value:[UIFont systemFontOfSize:14]
                            range:NSMakeRange(0, holderText.length)];
        textField.attributedPlaceholder = placeholder;
        textField.clearButtonMode = UITextFieldViewModeWhileEditing;
        textField.returnKeyType = UIReturnKeySearch;
        textField.keyboardType = UIKeyboardTypeNumberPad;
        self.textFild = textField;
        
        GLGWView *vi = [[GLGWView alloc] initWithInSuperView:midelView];
        vi.backgroundColor = [UIColor colorWithHexString:@"#EAEAEA"];
        [vi mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.right.equalTo(self.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(midelView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(44));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(1)));
        }];
        
        GLGWButton *withDrawBtn = [[GLGWButton alloc] initWithTitle:@"申请提现" titleLableFont:SYSTEMFONT(16) titleLableColor:[UIColor colorWithHexString:@"#FFFFFF"] inSuperView:self];
        [withDrawBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(midelView.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(48));
            make.right.equalTo(self.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.left.equalTo(self.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(44)));
        }];
        [withDrawBtn setBackgroundImage:[UIImage imageWithStartColor:[UIColor colorWithHexString:@"#A89A60" alpha:1] endColor:[UIColor colorWithHexString:@"#A89A60" alpha:0.8]] forState:UIControlStateNormal];
        withDrawBtn.backgroundColor = [UIColor colorWithHexString:@"#D8D8D8"];
        withDrawBtn.layer.masksToBounds = YES;
        withDrawBtn.layer.cornerRadius = kHeightProportion_In_iPhoneTriploid(22);
        self.withDrawBtn = withDrawBtn;
    }
    return self;
}

- (void)setIphoneStr:(NSString *)iphoneStr
{
    _iphoneStr = iphoneStr;
    lab.text = iphoneStr;
}

@end
